import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/pages/home/Home'
import City from '@/components/pages/city/City'
import Detail from '@/components/pages/detail/detail'
Vue.use(Router)

export default new Router({
  routes: [{
    path: '/',
    name: 'Home',
    component: Home
  }, {
    path: '/city',
    name: 'City',
    component: City
  }, {
    // /detail/后面的参数放到id里面
    path: '/detail/:id',
    name: 'Dedail',
    component: Detail
  }],
  // 每次路由跳转的时候，让新的页面x，y的页面回到最顶部
  scrollBehavior(to, from, savedPosition) {
    return {
      x: 0,
      y: 0
    }
  }
})
